package hn.cch.entity;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by chench on 4/18/20.
 */
public class Message {

    private int code;
    private String info;

    private Map<String, Object> data = new HashMap<String, Object>();

    public static Message success(){
        Message message = new Message();
        message.setCode(200);
        message.setInfo("成功");
        return message;
    }

    public static Message failed(){
        Message message = new Message();
        message.setCode(400);
        message.setInfo("失败");
        return message;
    }

    public Message add(String key,Object value){
        this.getData().put(key, value);
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }
}
